define([], function() {
	return {
		title: ['<a href="user.html">个人中心</a>', "我的店铺"],
		init: function(content) {

			let gisDiv = content.children("._gis");

			content.find("._gis").on("click", function() {
				gisDiv.toggle();
			});

			let ts = ["外卖", "酒店"];
			let ns = ["审批中", "未通过", "通过"];
			let imgs = content.find(".image-item._imgs");
			let cs = content.find(".image-item._cs");


			$.get(
				"shops/apply.do",
				function(data) {
					data.shops.name = ns[data.shops.shopStatus];
					data.shops.shopsTypeName = ts[data.shops.shopTypeId];
					$.each(data.shops, function(name, value) {
						content.find("[name='" + name + "']").val(value);
						content.find("._" + name).text(value);
					});
					content.find("[name='lng']").val(data.shops.point.x);
					content.find("[name='lat']").val(data.shops.point.y);
					window.frames.gis.addEventListener("map-select", function() {
						window.frames.gis.add(data.shops.shopName, data.shops.point.x, data.shops.point.y, data.shops);
						window.frames.gis.setCenter(data.shops.point.x, data.shops.point.y);
					});
					content.find(":input:not(._gis)").attr("disabled", "disabled").css("background-color", "#FFF");

					$.each(data.shops.img, function(i, v) {
						let temp = imgs.clone();
						temp.find("a").attr("href", v + "?download=0");
						temp.find("img").attr("src", v);
						imgs.before(temp);
					});
					imgs.remove();

					$.each(data.shops.certificates, function(i, v) {

						let temp = cs.eq(i);
						temp.find("a").attr("href", v + "?download=0");
						temp.find("img").attr("src", v);

					});

				}, "json"
			);

		}
	}
});